所以这是我第一次使用 Reanimated 2,不幸的是我的应用程序因上述消息而崩溃。无法查看我的应用程序屏幕。
不变违规:TurboModuleRegistry.getEnforcing(...):找不到“NativeReanimated”。验证此名称的模块是否已在本机二进制文件中注册。
我在这里使用 reanimated
import React from 'react'
import Item from '../../Common/Item'
import {View,Text,FlatList,StyleSheet , TouchableOpacity} from 'react-native'
import Animated, {useAnimatedStyle} from 'react-native-reanimated';
import {bin,mix,useTiming} from 'react-native-redash'
const {interpolate,not}=Animated
const SectorItem=({sector,clients,index,opened,toggleSector})=> {
const {name}=sector
const ITEM_HEIGHT = 100
const transition = useTiming(opened)
const style = useAnimatedStyle(()=>({
height: mix(transition,0,clients.length * ITEM_HEIGHT)
}))
//here we wll also have the clients of each sector
return <Item xStyle={styles.item}>
<View>
<Text>{name}</Text>
<TouchableOpacity onPress={e=>toggleSector(index)}>
<Text>open</Text>
</TouchableOpacity>
</View>
<Animated.View style={style}>
<FlatList
data = {clients}
style …Run Code Online (Sandbox Code Playgroud) 当我尝试使用此命令安装节点版本
nvm install或nvm install 10.6.0
得到此输出时:
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aes-x86_64.s:2:1: error: unknown directive
.type _x86_64_AES_encrypt,@function
^
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aes-x86_64.s:154:1: error: unknown directive
.size _x86_64_AES_encrypt,.-_x86_64_AES_encrypt
^
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aes-x86_64.s:155:1: error: unknown directive
.type _x86_64_AES_encrypt_compact,@function
^
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aesni-mb-x86_64.s:6:1: error: unknown directive
.type aesni_multi_cbc_encrypt,@function
^
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aesni-mb-x86_64.s:7:8: error: invalid alignment value
.align 32
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aes-x86_64.s:327:1: ^
error: unknown directive
.size _x86_64_AES_encrypt_compact,.-_x86_64_AES_encrypt_compact
^
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aes-x86_64.s:329:1: error: ../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aesni-mb-x86_64.s:100:8: unknown directive
.type AES_encrypt,@function
error: ^
invalid alignment value
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aes-x86_64.s:332:1: .align 32
^
error: unknown directive
.hidden asm_AES_encrypt
^
../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aes-x86_64.s:394:1: ../deps/openssl/config/archs/linux-x86_64/asm/crypto/aes/aesni-mb-x86_64.s:207:8: error: error: unknown directive
invalid …Run Code Online (Sandbox Code Playgroud) 我使用的命令:arch -arm64 brew install v8@3.15
这里是我收到的错误:
Error: v8@3.15: no bottle available!
You can try to install from source with:
brew install --build-from-source v8@3.15
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.
Run Code Online (Sandbox Code Playgroud) 我将 CollectionPage 的组件更改为箭头函数组件,而不仅仅是普通函数,然后出现此错误,但我不知道为什么当我对许多其他组件执行相同操作时它没有抛出此错误。这是组件代码
import { from } from 'core-js/fn/array'
import React from 'react'
import { useParams } from 'react-router-dom'
import Products from '../Products/Products'
import {H1} from '../../Style/global'
const CollectionPage=()=> {
const {collectionTitle}= useParams()
return (
<div style={{marginTop:96}}>
<H1>{collectionTitle} Collection</H1>
<Products collectionTitle={collectionTitle}/>
</div>
)
}
export default CollectionPage
Run Code Online (Sandbox Code Playgroud)
顺便说一句,这是一个 react webpack 项目,这是我的 webpack 配置:
const path = require('path')
const HTMLPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin');
module.exports ={
entry :"./src/index.js",
output:{
path:path.resolve(__dirname,"./dist"),
filename:'index.js',
},
plugins:[
new HTMLPlugin({template:'./src/index.html'}),
new CopyPlugin({
patterns: [ …Run Code Online (Sandbox Code Playgroud)
function findSmallestPositiveInteger(A) {
// sort array from smallest to largest number
A.sort((a, b) => a - b)
// remove duplicates because they just would take memory
const noDups =Array.from(new Set(A).keys())
let smallestPositiveInteger=1
let previous = noDups[0]
if(previous <= smallestPositiveInteger && previous>0)
smallestPositiveInteger++
for(let i =1;i<noDups.length;i++){
const v = noDups[i]
if(previous > 0){
const diffWithPrevious = v - previous
// the logic for this early return is that we might not need to traverse
// the whole array for example imagine …Run Code Online (Sandbox Code Playgroud)