简体   繁体   English

Native Base:如何找到源代码<input> ?

[英]Native Base: how to find source code of <Input>?

I'm using the <Input> component from Native Base in my React Native app.我在我的 React Native 应用程序中使用来自Native Base<Input>组件。

I want to find the source code, so I looked in node_modules/native-base/src/index.js and it has a line that says import { Input } from './basic/Input';我想找到源代码,所以我查看了node_modules/native-base/src/index.js ,它有一行写着import { Input } from './basic/Input'; . . So I went to node_modules/native-base/src/basic/Input.js .所以我去了node_modules/native-base/src/basic/Input.js I tried editing this file in order to see whether it affected the Input I had have rendered in my app, and thus confirm whether this is the correct source file.我尝试编辑此文件以查看它是否影响了我在应用程序中呈现的Input ,从而确认这是否是正确的源文件。 Nothing changed anything;什么都没有改变; even when I commented out the entire Input.js file, nothing changed.即使我注释掉了整个Input.js文件,也没有任何改变。

Where did I go wrong here, and how should I approach finding this file?我在哪里 go 错了,我应该如何找到这个文件?

 *render() {
        const { input, meta, ...inputProps } = this.props;
    
        return (
          <InputGroup underline>
            <Input
              onChangeText={input.onChange}
              onBlur={input.onBlur}
              onFocus={input.onFocus}
              value={input.value}
              {...inputProps}
            />
          </InputGroup>
        );
      }*

If you wanted to check the source code, then checkout如果您想查看源代码,请查看

If you want to update the files in your node_modules , you need to know a few things如果你想更新node_modules中的文件,你需要知道一些事情

  1. Usually node_modules/native-base/src should be the last place you should visit.通常node_modules/native-base/src应该是您应该访问的最后一个地方。 Because bundlers usually don't look into this.因为捆绑商通常不会对此进行调查。
  2. So the code which is actually being used, exist in either of the 2 place based on your bundler.因此,实际使用的代码存在于基于您的捆绑器的两个位置中的任何一个中。 node_modules/native-base/lib/module/components/primitives/Input/Input.tsx node_modules/native-base/lib/commonjs/components/primitives/Input/Input.tsx node_modules/native-base/lib/module/components/primitives/Input/Input.tsx node_modules/native-base/lib/commonjs/components/primitives/Input/Input.tsx

NOTE: My answer is based on the assumption you're NativeBase version 3.x .注意:我的回答是基于您是 NativeBase 版本3.x的假设。 For 2.x file path may change a little.对于2.x文件路径可能会稍有变化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM