Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions samples/react-native/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ module.exports = {
},
},
],
'react-native-reanimated/plugin',
],
};
1 change: 1 addition & 0 deletions samples/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"react-native": "0.73.2",
"react-native-gesture-handler": "^2.14.0",
"react-native-macos": "^0.73.0-0",
"react-native-reanimated": "3.8.1",
"react-native-safe-area-context": "4.8.0",
"react-native-screens": "3.29.0",
"react-native-vector-icons": "^10.0.3",
Expand Down
55 changes: 53 additions & 2 deletions samples/react-native/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ import {
} from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { createStackNavigator } from '@react-navigation/stack';

import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Animated, {
Easing,
useAnimatedStyle,
useSharedValue,
withRepeat,
withTiming,
} from 'react-native-reanimated';

// Import the Sentry React Native SDK
import * as Sentry from '@sentry/react-native';
Expand All @@ -22,7 +28,7 @@ import { Provider } from 'react-redux';
import { store } from './reduxApp';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import GesturesTracingScreen from './Screens/GesturesTracingScreen';
import { Platform, StyleSheet } from 'react-native';
import { Platform, StyleSheet, View } from 'react-native';
import { HttpClient } from '@sentry/integrations';
import Ionicons from 'react-native-vector-icons/Ionicons';
import PlaygroundScreen from './Screens/PlaygroundScreen';
Expand Down Expand Up @@ -227,14 +233,59 @@ function BottomTabs() {
}}
/>
</Tab.Navigator>
<RunningIndicator />
</NavigationContainer>
);
}

function RunningIndicator() {
if (Platform.OS !== 'android' && Platform.OS !== 'ios') {
return null;
}

return <RotatingBox />;
}

function RotatingBox() {
const sv = useSharedValue<number>(0);

React.useEffect(() => {
sv.value = withRepeat(
withTiming(360, {
duration: 1_000_000,
easing: Easing.linear,
}),
-1,
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const animatedStyle = useAnimatedStyle(() => ({
transform: [{ rotate: `${sv.value * 360}deg` }],
}));

return (
<View style={styles.container}>
<Animated.View style={[styles.box, animatedStyle]} />
</View>
);
}

const styles = StyleSheet.create({
wrapper: {
flex: 1,
},
container: {
position: 'absolute',
left: 30,
top: 30,
},
box: {
height: 50,
width: 50,
backgroundColor: '#b58df1',
borderRadius: 5,
},
});

export default Sentry.wrap(BottomTabs);
Loading