小编Sat*_*ill的帖子

我可以在 FlatList (React Native) 中使用 FlatList 吗?

Now I want to build a small library app. In this app, I am using FlatList. Then can I use FlatList in a FlatList? So can I get this kind of effect with FlatList? Now I am thinking as follows. Is this possible method? If this method is possible, how to use it? I wish any sample code even very simple.

<FlatList
    data={this.state.countryList}
    renderItem={({ country }) => (
        <FlatList
            horizontal
            data={this.props.album ? this.props.album.mostDown : []}
            renderItem={({ item }) => ( …
Run Code Online (Sandbox Code Playgroud)

react-native

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

是否可以在 React Native 标签中使用 &lt;div&gt; 标签?

现在我使用 firebase JS SDK 来使用电话身份验证。我跟着web method.

这是我的代码:

  handleClick = () => {
    this.state.verify_otp = "flex";
    this.state.register = "none";
    this.recaptcha = new firebase.auth.RecaptchaVerifier("recaptcha1");
    this.number = this.state.phone;
  };
Run Code Online (Sandbox Code Playgroud)

<View
    style={{
        alignItems: "center",
        justifyContent: "center",
        flex: 1,
        display: this.state.captcha,
    }}
>
    <div>
        <div id="recaptcha1"></div>
    </div>
</View>
Run Code Online (Sandbox Code Playgroud)

是否可以在react-native代码中使用标签?

react-native

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

React Native fontWeight 在 iOS 中不起作用

我在 React Native 应用程序中使用了一个简单的文本组件。那么 fontWeight(仅粗体)仅不适用于 iOS。我已经在项目中插入了所有需要的字体(所有字体都在 Android 上运行良好)。

这是我的项目设置。

根/react-native.config.js

module.exports = {
  project: {
    ios: {},
    android: {},
  },
  assets:['/src/assets/fonts/']
}
Run Code Online (Sandbox Code Playgroud)

包.json

{
  "name": "boldfont",
  "version": "0.0.1",
  "private": true,
  "rnpm": {
    "assets": [
      "./src/assets/fonts"
    ]
  },
...  ...  ...
}
Run Code Online (Sandbox Code Playgroud)

根/src/资产/字体/ 在此输入图像描述

我也将所有这些字体添加到 android/app/src/main/assets/fonts 中。

That is my code.
Run Code Online (Sandbox Code Playgroud)

文本.js

import React from 'react';
import styled from 'styled-components/native';

function Stext({ ...props }) {
    return <Text {...props}>{props.children}</Text>
}

const Text = styled.Text`
    ${({ title, medium, small }) => {
        switch (true) …
Run Code Online (Sandbox Code Playgroud)

react-native

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

如何在样式组件中使用“悬停”(CSS) 操作?

我在 React.js 应用程序中使用了 Styled-components。我想对鼠标悬停操作进行一些区域模糊。所以我尝试使用&:hover,除了背景效果之外,所有线条在&:hover区域中都工作正常。

如何在样式组件中制作模糊效果(鼠标悬停时)?

我的代码

const Adiv = styled.div`
  width: 300px;
  height: 60px;
  background: #ffa5;
  &:hover {
    backdrop-filter: blur(2px);          // This line doesn't work
    -webkit-backdrop-filter: blur(2px);  // This line doesn't work
    cursor: pointer;
    border: 1px solid red;
  }
`
Run Code Online (Sandbox Code Playgroud)

但当我尝试使用普通 HTML(例如 w3schools.com/“亲自尝试”)时,效果很好。

<!DOCTYPE html>
<html>
  <head>
    <style>
      #aaa {
          width: 300px; 
          height: 60px; 
          position: absolute; 
          top: 150px; 
          left: 50px;
      }
      #aaa:hover {
          cursor: pointer;
          backdrop-filter: blur(5px);
          border: 1px solid red;
      }
    </style>
  </head>
  <body>
      <p>This …
Run Code Online (Sandbox Code Playgroud)

reactjs styled-components

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

undefined 不是一个对象(评估'data.length')

我对本机反应很陌生。我刚刚做了一个小应用程序。我想添加一些图片作为应用程序的介绍。所以我添加了“react-native-app-intro-slider”模块。然后我收到以下错误。

undefined 不是一个对象(评估'data.length')

那是我的app.js。我不确定问题是什么。

import React, { Component } from 'react';
import { StyleSheet, View, Text, Image } from 'react-native';
import AppIntroSlider from 'react-native-app-intro-slider';

const slides = [
  {
    key: 's1',
    text: 'Best Recharge offers',
    title: 'Mobile Recharge',
    image: require('./intro/(1).jpg'),
    backgroundColor: '#20d2bb',
  },
  {
    key: 's2',
    title: 'Flight Booking',
    text: 'Upto 25% off on Domestic Flights',
    image: require('./intro/(2).jpg'),
    backgroundColor: '#febe29',
  },
  {
    key: 's3',
    title: 'Great Offers',
    text: 'Enjoy Great offers on our all services',
    image: require('./intro/(3).jpg'),
    backgroundColor: …
Run Code Online (Sandbox Code Playgroud)

react-native

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

是否可以通过使用 HOC(高阶组件)在类组件中使用 React Hooks?

我可以在类组件中使用功能组件吗?我将调用从类组件中的功能组件中提取的函数。但它给出了如下错误。

未处理的拒绝(错误):无效的挂钩调用。钩子只能在函数组件的主体内部调用。出现这种情况可能是由于以下原因之一

所以我尝试在功能组件中调用它,但即使在功能组件中,我也遇到了与在类组件中调用它时相同的错误。

功能组件

import React, { useEffect } from 'react';
import { UseWalletProvider, useWallet } from 'use-wallet';
import { providers } from 'ethers';

export function App() {
  useEffect(() => {
    async function GetBlockId() {
      const wallet = useWallet();
      console.log(wallet); // =====> This is not displaying.
      const { ethereum, connect } = wallet;
      const ethersProvider = new providers.Web3Provider(ethereum);
      const { blockNumber } = await ethersProvider.getTransaction(hash);
      console.log(blockNumber);
    };
    GetBlockId()
  }, []);

  return <div>
    <h1>{wallet}</h1>
  </div>
}
Run Code Online (Sandbox Code Playgroud)

类组件

import React, …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-hooks wallet-connect

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