I followed the istruction here, but it still doesn't work.
I am trying this external component: https://www.npmjs.com/package/react-native-typewriter
So, I have installed it with:
npm install --save react-native-typewriter
and then I have wrote this code:
index.android.js
'use strict';
import {AppRegistry} from 'react-native';
import TypingText from './app/textanimation.js';
AppRegistry.registerComponent('AwesomeProject', () => TypingText );
textanimation.js
import React, {Component} from 'react'
import TypeWriter from 'react-native-typewriter';
class TypingText extends Component {
render() {
return <TypeWriter typing={1}>Hello World!</TypeWriter>
}
}
export default TypingText;
package.json
{
"name": "AwesomeProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.2",
"react-native": "0.41.2",
"react-native-push-notification": "^2.2.1",
"react-native-sound": "^0.9.0",
"react-native-typewriter": "^0.3.0",
"react-native-vector-icons": "^4.0.0"
},
"devDependencies": {
"babel-jest": "18.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "18.1.0",
"react-test-renderer": "15.4.2"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"assets/fonts/04b03"
]
}
}
But I get the error below:
Seems you're trying to access 'ReactNative.Component' from the 'react-native' package. Perhaps you meant to access 'React.Component' from the 'react' package instead?
For example, instead of: import React, { Component, View } from 'react-native'; You should now do: import React, { Component } from 'react'; import { View } from 'react-native'; Check the release notes on how to upgrade your code - https://github.com/facebook/react-native/releases/tag/v0.25.1
TextAnimation
it should beTypingText
in index.android.js – Neel Galatextanimation.js
is totally right, check yourindex.android.js
where you have imported on 2nd lineTextAnimation
it should beTypingText
– Neel Gala