Skip to content

Commit

Permalink
Update rn docs
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell authored Apr 27, 2024
1 parent 60a0e76 commit e409a59
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,34 @@ Versions 3/4 supported a UMD-style module in the browser, but this is no longer

#### React-Native support

React-Native is better supported as of version `5.4.0`, using a specific build for the platform. The import should be automatic, but can be forced by importing from `/react-native` directly:
React-Native is better supported as of version `5.6.0`, using a specific build for the platform. The import should be automatic, but can be forced by importing from `/react-native` directly:

```typescript
import { createClient } from "webdav/react-native";
```

**NB:** Note that for some reason, the Metro build system doesn't properly resolve using these entries, and you may need to customise your babel config for React Native to correctly import this library:

```javascript
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
plugins: [
[
"module-resolver",
{
alias: {
// Point the webdav client entry to the react native build:
webdav: "webdav/dist/react-native"
},
extensions: [".tsx", ".ts", ".js", ".jsx", ".json"]
}
]
]
};
```

When using this override, you can simply import from `webdav`.

### Types

Typescript types are exported with this library for the Node build. All of the types can also be directly imported from the module:
Expand Down

0 comments on commit e409a59

Please sign in to comment.