-
Notifications
You must be signed in to change notification settings - Fork 44
Description
I have a React Native app, now I am trying to build for web with react-native-web. The vite dev server serves the app and it works ok, navigation works correctly.
However, if I build with vite, and serve it using a simple nginx server to test, I get a warning like "you forgot to configure remote control, make sure you called configureRemoteControl".
My entrypoint is like this
console.log('configuring remote control');
SpatialNavigation.configureRemoteControl({
remoteControlSubscriber: (callback) => {
console.log('[CONFIG] Subscriber configured');
const mapping: { [key in SupportedKeys]: Directions } = {
[SupportedKeys.Right]: Directions.RIGHT,
[SupportedKeys.Left]: Directions.LEFT,
[SupportedKeys.Up]: Directions.UP,
[SupportedKeys.Down]: Directions.DOWN,
[SupportedKeys.Enter]: Directions.ENTER,
[SupportedKeys.LongEnter]: Directions.LONG_ENTER
};
const remoteControlListener = (keyEvent: SupportedKeys) => {
callback(mapping[keyEvent]);
return false;
};
return RemoteControlManager.addKeydownListener(remoteControlListener);
},
remoteControlUnsubscriber: (remoteControlListener) => {
console.log('[CONFIG] Unsubscriber configured');
RemoteControlManager.removeKeydownListener(remoteControlListener);
}
});
console.log('finished configuring');
AppRegistry.registerComponent(appName, () => App);
AppRegistry.runApplication(appName, {
rootTag: document.getElementById('app-root')
});I have a hard time debugging the bundled and obfuscated build, but from what I noticed, the remoteControlSubscriber and remoteControlUnsubscriber are
being assigned internally when SpatialNavigation.configureRemoteControl is called, but when the code for checking if configuration is done properly, remoteControlUnsubscriber is undefined which causes the warning to fire.
As far as I can tell, I don't have duplicated instances of SpatialNavigation, at least my code doesn't suggest it.
I know there isn't much info, I am just writing this to see if there has been such a problem or there is a gotcha I missed.
I am using vite v6.2