-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bump ios dependency to support Rive Events
- Loading branch information
Showing
11 changed files
with
137 additions
and
9 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { useRef, useState } from 'react'; | ||
import { | ||
SafeAreaView, | ||
ScrollView, | ||
StyleSheet, | ||
Linking, | ||
Text, | ||
} from 'react-native'; | ||
import Rive, { Fit, RiveOpenUrlEvent, RiveRef } from 'rive-react-native'; | ||
|
||
export default function Events() { | ||
const riveRef = useRef<RiveRef>(null); | ||
const [eventMessage, setEventMessage] = useState(''); | ||
|
||
return ( | ||
<SafeAreaView style={styles.safeAreaViewContainer}> | ||
<ScrollView contentContainerStyle={styles.container}> | ||
<Rive | ||
ref={riveRef} | ||
autoplay={true} | ||
fit={Fit.Cover} | ||
style={styles.box} | ||
stateMachineName="State Machine 1" | ||
onRiveEventReceived={(event) => { | ||
const eventProperties = event.properties; | ||
if (eventProperties?.message) { | ||
setEventMessage(eventProperties.message as string); | ||
} | ||
if ('url' in event) { | ||
Linking.openURL((event as RiveOpenUrlEvent).url || ''); | ||
} | ||
}} | ||
resourceName={'rating'} | ||
/> | ||
<Text>{eventMessage}</Text> | ||
</ScrollView> | ||
</SafeAreaView> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
safeAreaViewContainer: { | ||
flex: 1, | ||
}, | ||
container: { | ||
flexGrow: 1, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
marginBottom: 150, | ||
}, | ||
box: { | ||
width: '100%', | ||
height: 500, | ||
marginVertical: 20, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters