# @berty/gnonative

> Develop for Gno using your app's native language

Latest version **0.1.2** (published 2024-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @berty/gnonative
pnpm add @berty/gnonative
yarn add @berty/gnonative
bun add @berty/gnonative
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2024-04-05 |
| First published | 2024-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 122.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | D4ryl00 |
| Maintainers | d4ryl00, iuriberty, berty-staff, m42am |
| Keywords | react-native, expo, gnonative, Gnonative |

## Links

- npm: https://www.npmjs.com/package/@berty/gnonative
- Repository: https://github.com/gnolang/gnonative
- Homepage: https://github.com/gnolang/gnonative#readme
- Issues: https://github.com/gnolang/gnonative/issues
- npm.io page: https://npm.io/package/@berty/gnonative

## Dependencies (7)

- [js-base64](https://npm.io/package/js-base64.md) ^3.7.7
- [@bufbuild/protobuf](https://npm.io/package/@bufbuild/protobuf.md) ^1.8.0
- [fast-text-encoding](https://npm.io/package/fast-text-encoding.md) ^1.0.6
- [@connectrpc/connect](https://npm.io/package/@connectrpc/connect.md) ^1.4.0
- [@connectrpc/connect-web](https://npm.io/package/@connectrpc/connect-web.md) ^1.4.0
- [@buf/gnolang_gnonative.bufbuild_es](https://npm.io/package/@buf/gnolang_gnonative.bufbuild_es.md) ^1.8.0-20240327143536-1ec48ff39f30.2
- [@buf/gnolang_gnonative.connectrpc_es](https://npm.io/package/@buf/gnolang_gnonative.connectrpc_es.md) ^1.4.0-20240327143536-1ec48ff39f30.2

## Recent versions

- 0.1.2 (latest) — 2024-04-05
- 0.1.1 — 2024-04-05
- 0.1.0 — 2024-04-04

## README

# gnonative

Develop for Gno using your app's native language

# API documentation

We created a Javascript object helper (useGno) that wraps the RPC API. The
useGno object is defined in the GnoNative repo at `/expo/src/hooks/use-gno.ts`.

The RPC API documentation is avalaible in the Buf registry:

- [Documentation](https://buf.build/gnolang/gnonative/docs/main:land.gno.gnonative.v1)

# Installation in Expo projects

## Prerequisites

Please follow the general `Build instructions` in the main
[README](https://github.com/gnolang/gnonative/blob/main/README.md) and then:

```console
make asdf.install_tools
```

## Create new Expo app

```
npx create-expo-app my-app
cd my-app
```

## Add the package to your npm dependencies

```
npm install @berty/gnonative
```

## Customize the app

We prepared for you an example Hello World code.

Open App.js and replace the content by this:

```tsx
import React, { useEffect, useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';

import * as Gnonative from '@berty/gnonative';

export default function App() {
  const gno = Gnonative.useGno();
  const [greeting, setGreeting] = useState('');

  useEffect(() => {
    const greeting = async () => {
      try {
        // sync Hello function
        setGreeting(await gno.hello('Gno'));

        // async Hello function
        for await (const res of await gno.helloStream('Gno')) {
          console.log(res.greeting);
        }
      } catch (error) {
        console.log(error);
      }
    };
    greeting();
  }, []);

  return (
    <View style={styles.container}>
      <Text>Hey {greeting}</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```

## Run the app

```
# Re-generate the native project directories from scratch
npx expo prebuild --clean
# Run the example app on Android
npx expo run:android
# Run the example app on iOS
npx expo run:ios
```

# Installation in bare React Native projects

For bare React Native projects, you must ensure that you have
[installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/)
before continuing.

---
_Source: https://npm.io/package/@berty/gnonative · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
