如何在单独的样式表中使用react-native-active-dimensions

我是React和React Native的新手。我有一个名为SiteStyle.js的样式表和一个名为react-native-responsive-dimensions的npm组件。我试图使用样式表中包含的钩子,但始终收到错误消息:“无效的钩子调用。只能在函数组件的主体内部调用钩子...”如何调用钩子我单独的样式表?

SiteStyle.js

   int[,] array1 = new int[6,6]
        {
            {10,20,10,21,99 },{2,27,5,45,13 },{17,33,20 },{21,35,15,54,37 },{31,101,25,55,26,66 },{45,44,12,98 }
        };

        int Length = array1.GetLength(0);
        int Height = array1.GetLength(1);
        Console.WriteLine("  Col 0  Col 1  Col 2  Col 3  Col 4  Col 5");
        for (int i = 0; i < Length; i++)
        {
            for (int j = 0; j < Height; j++)
            {
                Console.Write(string.Format("{0,6} ",array1[i,j]));
            }
            Console.Write("\n" + "\n");
        }

        Console.ReadKey();

我在名为Home.js的文件中使用样式表,如下所示:

import { StyleSheet } from 'react-native'
import { useResponsiveFontSize } from "react-native-responsive-dimensions";

export default StyleSheet.create({
 homeCardTitle: {
    color: '#ffffff',fontSize: useResponsiveFontSize(1)
  },...
})
skywwh123 回答:如何在单独的样式表中使用react-native-active-dimensions

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3149561.html

大家都在问