Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ public class RuntimeUtils {
private static final Runnable sUIUpdateClosure = new Runnable() {
@Override
public void run() {
ReactContextHolder.getContext().getNativeModule(UIManagerModule.class).onBatchComplete();
UIManagerModule uiManager = ReactContextHolder.getContext().getNativeModule(UIManagerModule.class);
if (uiManager != null) {
uiManager.onBatchComplete();
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export type KeyboardAccessoryViewProps = kbTrackingViewProps & {
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardAccessoryView/KeyboardAccessoryView.gif?raw=true
*/
class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps> {
androidBackHandlerSubscription?: { remove: () => void };
static scrollBehaviors = KeyboardTrackingView.scrollBehaviors;

static defaultProps = {
Expand Down Expand Up @@ -94,8 +95,8 @@ class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps> {
if (this.customInputControllerEventsSubscriber) {
this.customInputControllerEventsSubscriber.remove();
}
if (IsAndroid) {
BackHandler.removeEventListener('hardwareBackPress', this.onAndroidBackPressed);
if (IsAndroid && this.androidBackHandlerSubscription) {
this.androidBackHandlerSubscription.remove();
}
}

Expand Down Expand Up @@ -146,7 +147,7 @@ class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps> {

registerAndroidBackHandler() {
if (IsAndroid) {
BackHandler.addEventListener('hardwareBackPress', this.onAndroidBackPressed);
this.androidBackHandlerSubscription = BackHandler.addEventListener('hardwareBackPress', this.onAndroidBackPressed);
}
}

Expand Down