问题描述
我正在尝试在Camera.js
组件中实现Reanimated底页。在我的renderContent
道具中,我渲染了另一个组件(MusicIcon2.js
),在MusicICon2.js
内部,我正在使用另一个包含可触摸不透明度的组件MusicIcon1
。我想设置“ Reanimated底部”页面中存在的这种可触摸不透明状态时,在Camera.js中显示状态songCamera
。
我无法执行此操作。请帮我解决这个问题。我已经附上了代码。
我在这里使用了复活的底页库。
!----- Camera.js ----!
import BottomSheet from 'reanimated-bottom-sheet';
class CameraScreen extends Component{
constructor(props){
super(props);
this.state={
songCamera:'',}
}
setMusic=()=>{
return(
<View style={{
width:width-20,height:600,backgroundColor:'#fff',borderRadius:25,marginHorizontal:10,}}>
<Text style={{alignSelf:'center'}}> Select a Song </Text>
<MusicIcon2/>
</View>
)
}
bs = React.createRef();
render(){
return(
<View>
<BottomSheet
ref={this.bs}
snapPoints={[600,0]}
initialSnap={1}
enabledContentGestureInteraction={true}
renderContent={this.setMusic}
/>
<TouchableOpacity
style={styles.musicConatiner} onPress={()=>{this.bs.current.snapTo(0)}}>
<Icon name='music' size={27} color='rgba(250,250,0.7)' />
</TouchableOpacity>
</View>
)
}
}
!---- MusicIcon2.js ----!
export default class Music extends Component {
render() {
return (
<View>
<MusicIcon1 title='Next to You' publishby='Black shalton' time='0.16' />
</View>
)
}
}
!---- MusicIcon1.js ---!
export default function MusicIcon(props) {
const { title,publishby,time,...otherProps } = props;
return (
<>
<TouchableOpacity onPress={()=>{ //code to update the state songCamera of Camera.js
bs.current.snapTo(1)}}>
<Icon name='plus' size={20} color='#202124' />
</TouchableOpacity>
</>
)
}
单击“加号”图标,状态songCamera
应更新为abc.mp3
。如何解决这个问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)