File tree Expand file tree Collapse file tree 8 files changed +26
-7
lines changed
android/src/main/java/com/reactnativerestart Expand file tree Collapse file tree 8 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,11 @@ jobs:
2323 with :
2424 filters : |
2525 android:
26- - 'android/**'
27- - 'Example/android/**'
26+ - 'android/*/* *'
27+ - 'Example/android/*/* *'
2828 ios:
29- - 'ios/**'
30- - 'Example/ios/**'
29+ - 'ios/*/* *'
30+ - 'Example/ios/*/* *'
3131
3232 setup :
3333 name : Setup code and environment needed for building, linting and tests
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ function App(): JSX.Element {
8080 backgroundColor : isDarkMode ? Colors . black : Colors . white ,
8181 } } >
8282 < Section title = "Step Zero" >
83- < TouchableOpacity onPress = { ( ) => RNRestart . Restart ( ) } >
83+ < TouchableOpacity onPress = { ( ) => RNRestart . restart ( ) } >
8484 < View style = { styles . restartButton } >
8585 < Text > Restart</ Text >
8686 </ View >
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ Remember to run `cd ios && pod install` to update files used by Xcode.
143143import RNRestart from ' react-native-restart' ; // Import package from node modules
144144
145145// Immediately reload the React Native Bundle
146- RNRestart .Restart ();
146+ RNRestart .Restart (); // Deprecated
147+ RNRestart .restart ();
147148```
148149
149150## Contributing
Original file line number Diff line number Diff line change @@ -99,6 +99,11 @@ public void Restart() {
9999 ProcessPhoenix .triggerRebirth (getReactApplicationContext ());
100100 }
101101
102+ @ ReactMethod
103+ public void restart () {
104+ ProcessPhoenix .triggerRebirth (getReactApplicationContext ());
105+ }
106+
102107 @ Override
103108 public String getName () {
104109 return "RNRestart" ;
Original file line number Diff line number Diff line change @@ -20,4 +20,15 @@ - (void)loadBundle
2020 return ;
2121}
2222
23+ RCT_EXPORT_METHOD (restart) {
24+ if ([NSThread isMainThread ]) {
25+ [self loadBundle ];
26+ } else {
27+ dispatch_sync (dispatch_get_main_queue (), ^{
28+ [self loadBundle ];
29+ });
30+ }
31+ return ;
32+ }
33+
2334@end
Original file line number Diff line number Diff line change 22
33export default {
44 Restart : jest . fn ( ) ,
5+ restart : jest . fn ( ) ,
56} ;
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ import RNRestart from "react-native-restart";
55
66describe ( "test RNRestart API functions" , ( ) => {
77 it ( "calls the restart function" , ( ) => {
8- RNRestart . Restart ( ) ;
8+ RNRestart . restart ( ) ;
99 } ) ;
1010} ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const { RNRestart } = NativeModules;
44
55type RestartType = {
66 Restart ( ) : void ;
7+ restart ( ) : void ;
78} ;
89
910export default RNRestart as RestartType ;
You can’t perform that action at this time.
0 commit comments