小编Alb*_*mos的帖子

如何在 React Native WebView 中自定义网站 CSS?

我一直在使用 React Native 上的 webview,但我想更改网站的 css 来自定义样式。有办法做到吗?

使用 React Native cli 和 Android Studio

import React from 'react';
import { StyleSheet, Text, View, Image, StatusBar, ScrollView, TouchableOpacity, WebView, ActivityIndicator } from 'react-native';

class king_of_prussia extends React.Component {

  static navigationOptions = {
       title: 'King Of Prussia',
       headerTitleStyle :{textAlign: 'center', alignSelf:'center', fontSize: 18, fontWeight: 'normal', color: '#3E3E40' },
       headerStyle:{
           backgroundColor:'white',
       },
   };

  ActivityIndicatorLoadingView() {
    return (
      <ActivityIndicator
        color='black'
        size='large'
        style={styles.ActivityIndicatorStyle}
      />
    );
  }

  render() {
    return (
        <View style={styles.container}>
        <StatusBar
            backgroundColor='#F1F1F1'
            barStyle='dark-content'/> …
Run Code Online (Sandbox Code Playgroud)

webview node.js reactjs react-native

2
推荐指数
1
解决办法
4982
查看次数

React Native TypeError:undefined 不是一个对象(评估'_ref.item')

我正在尝试进行 Instagram 克隆,但是在使用 FlatList 时出现此错误:

错误:类型错误:未定义不是对象(正在评估“_ref.item”)

我在 youtube 上遵循了本教程,我的代码与视频中的代码基本相同,我相信可能由于视频是 1 年前上传的,文档已更改。

在此处输入图片说明

使用 React Native Cli 和 android studio

import React, {Component} from "react";
import {FlatList} from "react-native";
import Post from "../presentation";

class PostFeed extends Component{

  _renderPost({ item }) {
    return <Post />;
  }

  _returnKey(item) {
    return item.toString();
  }

  render() {
    return (
      <FlatList
      data={[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]}
      keyExtractor={this._returnKey}
      renderItem={this._renderPost()}
    />
    );
  }
}

export default PostFeed;
Run Code Online (Sandbox Code Playgroud)

这是 InstaClone.js

import React, {Component} from "react";
import { View, Text, StyleSheet, Image, Dimensions, TouchableOpacity …
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-native-flatlist

1
推荐指数
1
解决办法
3967
查看次数