在没有点击反应本机的情况下调用渲染的方法

Method called on render without click react native

我遇到一个问题,在我的 React Native 应用程序中呈现时自动调用方法。以下是片段:

static navigationOptions = ({navigation}) => {
    return {
        headerTitle: 'Network',
        headerRight: () => (
            <View style={{flexDirection: 'row'}}>
            <Button
                title='Invite'
                color='#ccc'
                onPress={() => navigation.navigate('InviteUser')}
            />
                <Button
                    title='Search'
                    color='#ccc'
                    onPress={() => navigation.state.params.handleSearch}
                />
            </View>
            ),
    };
};

componentDidMount() {
    this.state = {
        dataSource:[],
    };
    this.props.navigation.setParams({ handleSearch: this.getNearbyUsers(user_id, auth_token)})
}

这是专门针对搜索按钮发生的。邀请工作正常。我对 RN 还是很陌生,所以有人可以帮忙吗?

编辑* 添加了 getNearbyUser():

getNearbyUsers(user_id, auth_token) {
    console.log('Get Users: id:' + user_id);
    let formData = new FormData();
    formData.append('user_id', user_id);
    formData.append('auth_token', auth_token);
    fetch("https://{url}", {
        method: 'POST',
        header: {
            Accept: 'application/json',
            'Content-Type': 'multipart/form-data'
        },
        body: formData
        //JSON.stringify({'user_id': user_id, 'auth_token': auth_token})//, 'latitude': 33.0296843, 'longitude': -96.7059628})
    }).then(response => response.json())
        .then((responseJson) => {
            // console.log(responseJson.users[0])
            this.createSearchList(responseJson.users)
        }).catch((error) => {
            console.log('Local Network Error: ' + error)
    })
}

改变

this.props.navigation.setParams({ handleSearch: this.getNearbyUsers(user_id, auth_token)})

this.props.navigation.setParams({ handleSearch: () => this.getNearbyUsers(user_id, auth_token)})