我正在使用react-navigation,我有一个视图,我想在工具栏中按下图标时显示,我已经使用另一个组件并将组件设置为绝对显示,事实是,所有touchEvents都是通过叠加视图,我尝试在headerRightStyle上设置zIndex和elevation,即使在另一个子视图中也是绝对的视图.我也尝试使用TouchableWithoutFeedback作为包装,但也没有解决问题.
这是我的组成部分
import React, { Component } from 'react';
import {
View,
Text,
UIManager,
LayoutAnimation,
Dimensions,
TouchableWithoutFeedback,
} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
const styles = {
movieFilterListContainerStyle: {
position: 'absolute',
bottom: -300,
right: -10,
height: 300,
},
};
class MovieFilter extends Component {
constructor(props) {
super(props);
this.state = {
showFilterList: false,
filterListWidth: 0,
};
this.renderFilterList = this.renderFilterList.bind(this);
this.onShowFilterList = this.onShowFilterList.bind(this);
this.calculateFilterListWidth = this.calculateFilterListWidth.bind(this);
}
componentWillMount() {
UIManager.setLayoutAnimationEnabledExperimental(true);
this.calculateFilterListWidth();
Dimensions.addEventListener('change', this.calculateFilterListWidth);
}
componentWillUpdate() {
LayoutAnimation.spring();
}
componentWillUnmount() {
Dimensions.removeEventListener('change', …Run Code Online (Sandbox Code Playgroud) 我的传奇根看起来像这样
export default function* root() {
yield takeLatest(LOAD_SEARCHRESULTS, getSearchResults);
}
Run Code Online (Sandbox Code Playgroud)
它监视LOAD_SEARCHRESULTS动作,然后调用getSearchResults函数.
有什么方法可以在root中观看多个动作吗?像这样的东西:
export default function* root() {
yield takeLatest(LOAD_SEARCHRESULTS, getSearchResults);
yield takeLatest(CHANGE_ALIASFILTER, getSearchResults);
yield takeLatest(CHANGE_CATFILTER, getSearchResults);
}
Run Code Online (Sandbox Code Playgroud)
因此,如果其中任何一个操作进入 - 它调用getSearchResults.我已经尝试过全部收益([])和takeEvery但它只是观察第一个动作.
我使用react-native-webrtc实现了基于WebRTC的视频通话.它是一对一的呼叫并且工作正常,但是当我断开呼叫并尝试再次重新连接时,重新连接需要花费大量时间并且有时会挂起应用程序.以下是断开连接的代码:
function stopLocalStream() {
if (friends != null) {
friends.forEach(friend => {
leave(friend.socketId)
})
}
if (localStream != null) {
localStream.getTracks().forEach(t => t.stop())
localStream.release()
localStream = null
}
}
function leave(socketId) {
console.log('leave', socketId)
var pc = peerConnections[socketId]
if (pc) {
pc.close()
}
delete peerConnections[socketId]
if (onFriendLeftCallback != null) {
onFriendLeftCallback(socketId)
}
}
Run Code Online (Sandbox Code Playgroud)
我认为我没有正确断开视频通话.任何帮助将非常感谢谢谢.
在这里,我使用的是基于本地的最新版本,并使用所有方法道具,但我的图标仍未出现在标题中
import React, { Component } from "react";
import {
View,
Text,
StyleSheet
} from "react-native";
import {Header,Icon} from 'native-base'
class HomeScreen extends Component {
static navigationOptions = { header: null }
render() {
return (
<View style={{flex:1,backgroundColor:'#3q455c',width:"100%"}}>
<Header
placement="left"
leftComponent={{ icon: 'menu', color: 'white' }}
centerComponent={{ text: 'MY TITLE', style: { color: 'white' } }}
rightComponent={{ icon: 'home', color: 'white' }}
/>
</View>
);
}}
export default HomeScreen;
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个搜索屏幕,我有一个 FlatList 填充屏幕中所有未使用的空间,并具有将填充设置为 10 的样式。我现在有硬编码数据只是为了测试它在什么时候看起来像我一直向下滚动,最后一个文本元素被切成两半......如果我删除填充它会正确显示最后一个项目,但文本显示粘在 FlatList 的边框上,并向每个 FlatList 项目添加填充看起来像矫枉过正(正如有人在另一篇文章中建议的那样)。
导入屏幕.js:
const results = [
'asdasdasd',
'dasd cxzceewrw',
'rewr',
'jyuyjkyuj ky',
'iuyiuyiyuiuyiyuiyu',
'uyigfhg gerte ert',
'tert ert r ert',
'asdasdasd',
'dasd cxzceewrw',
'rewr',
'jyuyjkyuj ky',
'iuyiuyiyuiuyiyuiyu',
'uyigfhg gerte ert',
'tert ert r ert',
'asdasdasd',
'dasd cxzceewrw',
'rewr',
'jyuyjkyuj ky',
'iuyiuyiyuiuyiyuiyu',
'uyigfhg gerte ert',
'tert ert r ert',
'asdasdasd',
'dasd cxzceewrw',
'rewr',
'jyuyjkyuj ky',
'iuyiuyiyuiuyiyuiyu',
'uyigfhg gerte ert',
'tert ert r ert',
'dasd cxzceewrw',
'rewr',
'jyuyjkyuj ky',
'iuyiuyiyuiuyiyuiyu',
'uyigfhg gerte ert',
'tert …Run Code Online (Sandbox Code Playgroud) react-native react-native-text react-native-flatlist react-native-stylesheet
react-native ×4
android ×1
ios ×1
javascript ×1
react-redux ×1
reactjs ×1
redux-saga ×1
webrtc ×1