Skip to content

EvanBacon/react-native-ink

Repository files navigation

👋 Welcome to
react-native-ink

A library for creating CLIs with agnostic primitives like View, Text, Image, TextInput, etc...

GitHub Actions status


NOT READY YET :]

🏁 Setup

Install react-native-ink in your project.

yarn add react-native-ink

Alias react-native to react-native-ink:

  1. yarn add -D babel-plugin-module-resolver

  2. Create alias: babel.config.js

    module.exports = {
      // ...
      plugins: [
        [
          'babel-plugin-module-resolver',
          {
            alias: {
              'react-native': 'react-native-ink',
            },
          },
        ],
      ],
    };

⚽️ Usage

import React, { useEffect, useState } from 'react';
import { AppRegistry, View, Text, Image, TextInput } from 'react-native';

const Counter = () => {
  const [counter, setCounter] = useState(0);

  useEffect(() => {
    const timer = setInterval(() => {
      setCounter(prevCounter => prevCounter + 1);
    });

    return () => {
      clearInterval(timer);
    };
  });

  return (
    <View style={{ padding: 1 }}>
      <Text style={{ color: 'green' }}>{counter} tests passed</Text>
    </View>
  );
};

AppRegistry.registerComponent('main', () => Counter);

License

The Expo source code is made available under the MIT license. Some of the dependencies are licensed differently, with the BSD license, for example.


License: MIT