Open ionictest2017 opened 4 months ago
Hey, could you provide some code? I think this is related to the underlying "tricks" of the lib ;)
You can't unmount and remount elements as you will without a little thinking. You should read this in the docs: https://github.com/bamlab/react-tv-space-navigation/blob/main/docs/pitfalls.md#conditional-rendering
Usually, wrapping things with a SpatialNavigationNode that is never unmounted will fix the issue. Please tell me if it's not clear enough :)
here is my code
return (
<SpatialNavigationRoot>
<TouchableHighlight
hasTVPreferredFocus={this.state.showControls ? false : (this.state.actionSheet ? false : this.state.isAdVisible ? false : true) || (this.state.isSeekbarFocused ? false : true)}
isTVSelectable={this.state.showControls ? false : (this.state.actionSheet ? false : this.state.isAdVisible ? false : true) || (this.state.isSeekbarFocused ? false : true)}
onPress={this.events.onScreenTouch}
style={[styles.player.container, this.styles.containerStyle]}>
<View style={[styles.player.container, this.styles.containerStyle]}>
<Video
{...this.props}
controls={false}
ref={videoPlayer => (this.player.ref = videoPlayer)}
resizeMode={this.state.resizeMode}
volume={this.state.volume}
paused={this.state.paused}
muted={this.state.muted}
rate={this.state.rate}
onLoadStart={this.events.onLoadStart}
onProgress={this.events.onProgress}
onError={this.events.onError}
onLoad={this.events.onLoad}
onEnd={this.events.onEnd}
onSeek={this.events.onSeek}
style={[styles.player.video, this.styles.videoStyle]}
onAudioTracks={this.onAudioTracks}
onTextTracks={this.onTextTracks}
onVideoTracks={this.onVideoTracks}
selectedTextTrack={this.state.selectedTextTrack}
selectedAudioTrack={this.state.selectedAudioTrack}
selectedVideoTrack={this.state.selectedVideoTracks}
source={this.state.video_source}
bitRateSelected={this.state.bitRateSelected}
onBuffer={this.events.onBuffer}
/>
{this.renderError()}
{this.props.control ? this.renderLoader() : null}
{this.state.controls && this.renderTopControls()}
{/* {this.props.control && this.renderBottomControls()} */}
{this.toggelNativeAdControls()}
{this.state.actionSheet && <SubtitlesModal
isModalVisible={this.state.actionSheet}
setIsModalVisible={(isModal)=> this.setState({ actionSheet: isModal })}
setSubtitles={(subT)=>console.log(subT)}
audioTracks={this.state.audioTracks}
textTracks={this.state.textTracks}
videoTracks={this.state.videoTracks}
selectedTextTrack={this.state.selectedTextTrack}
selectedAudioTrack={this.state.selectedAudioTrack}
selectedVideoTrack={this.state.selectedVideoTracks}
videoBitrate={this.state.bitRateSelected}
onAudioTracksChange={(item) => this._onChangeAudio(item)}
isFullScreen={this.props.fullscreen}
onTextTracksChange={(item) => this._onChangeText(item)}
onVideoTrackChange={(item) => this._onChangeVideoBitrate(item)}
onCancel={() => this.setState({ actionSheet: false, setTvFocus: true })}
onTextTracksOff={() => this.onTextTracksOff()}
/>}
</View>
</TouchableHighlight>
</SpatialNavigationRoot>
);
and here is my SubtitlesModal ` return (
);`
Hum, I'm not sure I understand what you've done 😁 You're not supposed to use any Touchable with this lib, we're overriding the whole focus system by creating fake touchables using our own styled views.
Describe the bug I have a player screen with controls with a modal popup which has some buttons like audio, subtitle, etc whenever I select any button and then close the modal then change my bottom control direction (left-right to right-left) .
Version and OS