# 초기화하기

Wepin React Native SDK를 초기화하는 방법입니다.

## Import SDK

```javascript
import Wepin from '@wepin/react-native-sdk
const wepin = Wepin.getInstance()
```

&#x20;<mark style="color:blue;">`<Wepin.WidgetView>`</mark> 컴포넌트를 메인 컴포넌트에 추가합니다. 그리고 그 안에 콘텐츠를 넣습니다.&#x20;

```javascript
function App(): JSX.Element {
    ....
  return (
    <Wepin.WidgetView>
        ...
    </Wepin.WidgetView>
  )
}
```

## init

```javascript
await wepin.init(appId, appSdkKey[, attributes])
```

Wepin 인스턴스를 초기화 합니다. &#x20;

### Parameters

* **appId**: *String*\
  앱 등록시 할당 받은 ID
* **appKey**: *String*\
  앱 등록시 할당 받은 키 값
* **attributes**: *IAttributes (optional)*\
  위핀 위젯의 속성 값. [`@wepin/types`](https://github.com/WepinWallet/wepin-js-sdk-types) 에 선언되어 있습니다.&#x20;
  * **type**: *String*\
    처음 로딩 시 앱 위젯 윈도우를 어떻게 보여줄 지를 결정 합니다. 기본 값은 `hide` 입니다. \
    `show`: 처음 로딩 후, 바로 위젯 윈도우를 띄워서 보여 줍니다. \
    `hide`: 는 처음 로딩시 위젯 윈도우를 보여주지 않고 숨깁니다. 이후 `openWindow()`을 통해서 위젯 윈도우을 띄워 보여 줍니다.
  * **defaultLanguage**: *String*\
    위젯 기본 언어 설정, 기본 값은 `ko`입니다. 현재 지원하는 언어는 `en`, `ko` 2가지 입니다.
  * **defaultCurrency:** *String*\
    위젯 기본 통화 설정, 기본 값은 `KRW`입니다. 현재 지원하는 통화는 `USD`, `KRW` 2가지 입니다.&#x20;
  * **loginProviders**: *\[String]*

    로그인 프로바이더 리스트 입니다.   현재 지원하는 프로바이더는 `google`, `apple` , `naver`, `discord` 이렇게 4가지 입니다.  필요한 로그인 프로바이더만 정의해서 사용하세요.  이 값을 지정하지 않으면  기본적으로 4개의 프로바이더 모두를 이용할 수 있습니다.

    * &#x20;`loginProviders` 파라미터는`@wepin/types`   version `v0.0.11`부터 지원합니다.&#x20;

### Example

```javascript
await wepin.init('APPID', 'APPKEY', {
  type: 'hide',
  defaultLanguage: 'en',
  defaultCurrency: 'USD',
  loginProviders: ['google', 'apple'],
})
```

## isInitialized <a href="#user-content-isinitialized" id="user-content-isinitialized"></a>

```javascript
wepin.isInitialized()
```

<mark style="color:blue;">`isInitialized()`</mark> 는 Wepin의 초기화 여부를 반환합니다.&#x20;

### Return value

* \<boolean>\
  초기화가 정상적으로 잘 된 경우 true , 실패한 경우 false 를 반환합니다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wepin.io/deprecated/react-native-sdk/init.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
