-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add reason to react-native patch package (#256)
- Loading branch information
1 parent
1b8a989
commit 62143b2
Showing
4 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,13 +1,27 @@ | ||
import { NativeModules } from "react-native"; | ||
|
||
const { RNRestart } = NativeModules; | ||
const { RNRestart: rnRestart } = NativeModules; | ||
|
||
type RestartType = { | ||
/** | ||
* @deprecated use `restart` instead | ||
*/ | ||
Restart(): void; | ||
restart(): void; | ||
getReason(): Promise<string>; | ||
}; | ||
|
||
export default RNRestart as RestartType; | ||
const Restart = (reason?: string) => { | ||
if (!reason) { | ||
rnRestart.Restart(null); | ||
} else { | ||
rnRestart.Restart(reason); | ||
} | ||
}; | ||
const RNRestart: RestartType = { | ||
...rnRestart, | ||
restart: Restart, | ||
Restart, | ||
}; | ||
|
||
export default RNRestart; |