我正在使用 React 原生导航。(堆栈导航)。但是我不能在 navigationOptions 中调用函数。不工作。
import React, { Component } from 'react';
import { StyleSheet, View, Text, TouchableHighlight, AsyncStorage, Alert } from 'react-native';
import { Button } from 'react-native-elements';
import Icon from 'react-native-vector-icons/FontAwesome';
import HandleBack from '../../HandleBack';
export default class Dashboard extends Component {
constructor(props) {
super(props);
}
static navigationOptions = ({ navigation }) => {
return {
title: 'Dasboard',
headerLeft: null,
headerRight: (
<TouchableHighlight underlayColor='transparent' onPress={this.login.bind(this)} style={{marginRight: 10}}>
<Icon
name="power-off"
size={25}
color="white"
/>
</TouchableHighlight>
)
};
};
login() { …Run Code Online (Sandbox Code Playgroud) 我使用 Scrollview,其中有 3 个视图。我在他们之间留了一个空隙。
例如:“marginRight:5”。
但我不希望在最后一个视图中出现这种差距。这就是为什么我需要这种东西。你能帮助我吗?